package top.tenebrous.yzl.instance;

import java.util.List;

/**
 * @Description:
 * 注册到服务端的实例接口
 * @Project: jestic-server
 * @Package: com.tenebrous.jestic
 * @Author: zhangya
 * @CreateTime: 2023-06-03  13:26
 * @Version: 1.0.0
 */
public interface InstanceContext {

    /**
     * @description:
     * 获取所有实例列表
     *
     * @author: zhangya
     * @date: 2023/6/3 13:30
     * @param:
     * @return:
     **/
    List<Instance> getInstance();

    /**
     * @description:
     * 获取某一服务实例列表
     *
     * @author: zhangya
     * @date: 2023/6/3 13:28
     * @param:
     * @return:
     **/
    List<Instance> getInstance(String serverName);

    /**
     * @description:
     * 获取某一个环境的所有实例
     *
     * @author: zhangya
     * @date: 2023/6/3 13:31
     * @param:
     * @return:
     **/
    List<Instance> getInstanceByEnv(String env);

    /**
     * @description:
     * 获取具体的实例
     *
     * @author: zhangya
     * @date: 2023/6/3 13:33
     * @param:
     * @return:
     **/
    Instance getInstance(String serverName, String instanceId);

    /**
     * @description:
     * 根据token获取实例
     *
     * @author: zhangya
     * @date: 2023/6/4 9:33
     * @param:
     * @return:
     **/
    Instance getInstanceByToken(String token);

    /**
     * @description:
     * 移除实例
     *
     * @author: zhangya
     * @date: 2023/6/4 16:36
     * @param:
     * @return:
     **/
    void removeInstance(Instance instance);

    /**
     * @description:
     * 根据服务签名获取获取实例
     *
     * @author: zhangya
     * @date: 2023/6/4 22:33
     * @param:
     * @return:
     **/
    Instance getInstanceBySign(String serverSign);

    /**
     * @description:
     * 根据实例id获取实例信息
     *
     * @author: zhangya
     * @date: 2023/6/6 20:52
     * @param:
     * @return:
     **/
    Instance getInstanceById(String id);
}
